const navTo = (url) => {
  if (!url) {
    uni.showToast({
      title: "请传入跳转路径",
      icon: "none",
    });
    return;
  }
  if (!hasLogin()) {
    url = "/pages/public/login";
  }
  uni.navigateTo({
    url,
  });
};



const hasLogin = () => {
  const res = uni.getStorageInfoSync();
  return res.keys.includes("token");
};
const msg = (title, duration = 1500, mask = false, icon = "none") => {
  //统一提示方便全局修改
  if (Boolean(title) === false) {
    return;
  }
  uni.showToast({
    title,
    duration,
    mask,
    icon,
  });
};
export default {
  navTo,
  hasLogin,
  msg,
};
